<template>
	<view class="content">
		<view class="salesman-card" @click.stop="scanCodeClick">
			<div class="salesman-p">
				<view class="title">二维码</view>
				<text class="info">扫描客户的二维码进行核销</text>
			</div>
			<image src="../../../static/my/QRcode.png" mode=""></image>
		</view>
		
		<view class="salesman-card" @click.stop="verifyClick">
			<div class="salesman-p">
				<view class="title">我的订单</view>
				<text class="info">管理客户订单，修改签署合同</text>
			</div>
			<image src="../../../static/my/order.png" mode=""></image>
		</view>
	</view>
</template>

<script setup>
	import { getUpdateQrCode } from '../../../api/order';
// 扫描二维码功能
async function scanCodeClick() {
	let res = await wx.scanCode({
		onlyFromCamera:true,
		scanType: ['qrCode']
	})
	console.log("二维码",res);
	const result = JSON.parse(res.result);
	const red = await getUpdateQrCode({ticketId:result.ticketId})
	console.log(red);
	uni.showToast({
		title:"核销成功"
	})
	// uni.navigateBack()
}

function verifyClick(){
	uni.navigateTo({ 
		url: '/pages/my/salesman/verify' ,
	})
}
</script>

<style>
.content{
	height: 100vh;
	background-color: #f3f3f3;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.salesman-card{
	margin-top: 40rpx;
	padding: 40rpx;
	width: 90vw;
	border-radius: 20rpx;
	background: linear-gradient(
		to bottom,
		white 30%,
		#e1efff 100%
	);
	box-shadow: 0rpx 5rpx 20rpx rgba(0, 0, 0, 0.3);
	
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.salesman-p{
	display: flex;
	flex-direction: column;
	gap: 30rpx;
}

.salesman-card image{
	width: 200rpx;
	height: 200rpx;
}
.title{
	font-size: 1.4rem;
	font-weight: bold;
}
.info{
	font-size: 0.9rem;
	color: #5cb9ff;
}
</style>